#include <iostream>
#include <vector>

using namespace std;

struct TreeNode {
	int val;
	struct TreeNode *left;
	struct TreeNode *right;
	TreeNode(int x) :
		val(x), left(NULL), right(NULL) {
	}
};

vector<vector<int> > FindPath(TreeNode* root, int expectNumber) {
	vector<vector<int> > path;
	if (root == NULL)
		return path;

	if (root->left == NULL && root->right == NULL)
	{
		if (root->val != expectNumber)
		{
			path.clear();
			return path;
		}
		else
		{
			vector<int> rootPath;
			rootPath.push_back(root->val);
			path.push_back(rootPath);
			return path;
		}
	}
	vector<vector<int> > left, right;
	if (root->left != NULL)
		left = FindPath(root->left, expectNumber - root->val);
	if (root->right != NULL)
		right = FindPath(root->right, expectNumber - root->val);
	if (left.size() == 0 && right.size() == 0)
	{
		path.clear();
		return path;
	}
	if(left.size() != 0)
		for (int i = 0; i < left.size(); ++i)
		{
			vector<int> p;
			p.push_back(root->val);
			p.insert(p.end(), left[i].begin(), left[i].end());
			path.push_back(p);
		}
	if(right.size()!= 0)
		for (int i = 0; i < right.size(); ++i)
		{
			vector<int> p;
			p.push_back(root->val);
			p.insert(p.end(), right[i].begin(), right[i].end());
			path.push_back(p);
		}
	return path;
}

//int main()
//{
//
//	system("pause");
//	return 0;
//}